# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php83-pecl-mongodb
_extname=mongodb
pkgver=1.19.4
pkgrel=0
pkgdesc="PHP 8.3 MongoDB driver - PECL"
url="https://pecl.php.net/package/mongodb"
arch="all"
license="Apache-2.0"
_phpv=83
_php=php$_phpv
depends="$_php-common"
makedepends="cyrus-sasl-dev icu-dev openssl-dev>3 $_php-dev snappy-dev zstd-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir"/$_extname-$pkgver
provides="$_php-mongodb=$pkgver-r$pkgrel" # for backward compatibility
replaces="$_php-mongodb" # for backward compatibility

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=/usr/bin/php-config$_phpv
	make
}

check() {
	# tests requires additional dependencies (vagrant)
	$_php -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
9d180d1de036d8c95506293a69397164a75dd184f454a9f199e3f7be8f09f9d7c1f41c07099105df09da6ef6596d991cbd6724883c660cb7514fc6e09663105f  php-pecl-mongodb-1.19.4.tgz
"
